//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<IScene.h>
///	@path	~/src/scene/
///	@date	2007/10/11
///	@desc	Scene interface.

#pragma once

#include "xeres.h"

#include "lib/math/vector.h"
#include "lib/math/matrix.h"
#include "lib/math/box.h"

#include "object/IObject.h"

#include "database/IData.h"

#include "graphics/animation/frame.h"

#include "scene/ScenePresentation.h"
#include "scene/ICamera.h"
#include "scene/resource/ResourceLoader.h"

namespace xeres {

	// forward declaration
	class IEntity;
	class ILive;

	/*!
		\class	IScene
		\brief
	*/
	class IScene : public IObject
	{
	public:

		/// \name Constructor & Destructor
		//@{

		/// \ctor
		IScene( void );

		/// \dtor
		virtual ~IScene( void );

		//@}

		DECL_IOBJECT_INTERFACE( IScene , IObject );

	public:

		/// \name Scene Interface
		//@{

		/*!
			\brief		Initialize scene by config.
			\param[in]	name	Scene name.
			\param[in]	dir		Scene resources.
		*/
		virtual bool Initialize( const WString& name , ResourceLoader * loader , RefWeak<IData> res ) = 0;

		/*!
			\brief		Finalize scene.
		*/
		virtual void Finalize( void ) = 0;

		/*!
			\brief		Start to load scene, schedule children.
		*/
		virtual void Preload( const Vector<float>& center ) = 0;

		/*!
			\brief		Enter scene.
		*/
		virtual void Enter( RefWeak<ICamera> camera ) = 0;

		/*!	
			\brief		Leave scene.
		*/
		virtual void Leave( void ) = 0;

		/*!
			\brief		Perform scene update.
		*/
		virtual void Tick( const Frame& frame ) = 0;

		/*!
			\brief		Make presentation of scene.
		*/
		virtual void Present( ScenePresentation& sp ) = 0;

		/*!
			\brief		Give a chance to process scene at synchronized point.
		*/
		virtual void Synchronized( void ) = 0;

		/*!
			\brief		Get axis aligned bounding box.
		*/
		virtual const Box<float>& GetBound( void ) = 0;

		//@}

		/// \name Live Management
		//@{

		/*!
			\brief		Creates new live by class name & configuration.
		*/
		RefPass<ILive> CreateLive( ResourceLoader * loader , RefWeak<IData> res );

		//@}

	private:

	};

} // namespace xeres
